﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WinLotto
{
    abstract class Lotto
    {
        protected int[] numberPool;
        protected int numberCount;

        public Lotto(string name, int maxNumber, int numberCount)
        {
            this.Name = name;
            this.numberPool = Sequence.Create(1, maxNumber);
            this.numberCount = numberCount;
        }

        public string Name { get; private set; }

        public virtual int[] Draw()
        {
            return numberPool
                .Shuffle(numberCount)
                .Take(numberCount)
                .OrderBy(x => x)
                .ToArray();
        }
    }


    class SuomiLotto : Lotto
    {
        public SuomiLotto() : base("Suomi", 39, 7)
        { }
    }


    class VikingLotto : Lotto
    {
        public VikingLotto() : base("Viking", 48, 6)
        { }
    }


    class EurojackpotLotto : Lotto
    {
        int[] bonusPool = Sequence.Create(1, 8);
        int bonusCount = 2;

        public EurojackpotLotto() : base("Eurojackpot", 50, 5)
        { }

        public override int[] Draw()
        {
            return numberPool
                .Shuffle(numberCount)
                .Take(numberCount)
                .OrderBy(x => x)
                .Concat(bonusPool
                    .Shuffle(bonusCount)
                    .Take(bonusCount)
                    .OrderBy(x => x))
                .ToArray();
        }
    }
}
